<form name="editor" action="" method="post" enctype="application/x-www-form-urlencoded">  
<link href="/css/bootstrap.min.css" rel="stylesheet"/>  
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<?php $listtype = $this->listtype;
    $count_type = count($listtype); ?>
<input readonly="readonly" type="hidden"  id="old_ep" name="old_ep" value="<?php echo $count_type;?>"/>
<input readonly="readonly" type="hidden"  id="del_ep" name="del_ep" value="0"/>
<input readonly="readonly" type="hidden"  id="add_ep" name="add_ep" value="0"/>
<div id="div_scents">
<?php
    for($i = 0;$i<$count_type;$i++){
        echo "<div class='news-content'><input type='text' id='ep-".$i."' size='20' name='ep-".$i."' value='".$listtype[$i][1]."' /><a href='#' id='remScnt'> Xóa</a></div>";
    };
 ?> 
</div>
<h2><a href="#" id="addScnt"><button>Thêm thể loại</button></a></h2>
<script>
	$(document).ready(function(){
        var scntDiv = $('#div_scents');
        var i = $('#div_scents div').size();
        var del = parseInt($('#del_ep').val());
        var add = parseInt($('#add_ep').val());
        $('#addScnt').live('click',function() {
                add = parseInt($('#add_ep').val());
                $('#add_ep').val(add + 1);
                $('<div class="news-content"><input type="text" id="ep-'+i+'" size="20" name="ep-' + i +'" value="" /><a href="#" id="remScnt"> Xóa</a></div>').appendTo(scntDiv);
                i++;
                return false;
        });
        $('#remScnt').live('click', function() {
                del = parseInt($('#del_ep').val());
                if( (i-del) > 1 ) {
                        $(this).parents('div.news-content').remove();
                        $('#del_ep').val(del + 1);
                }
                return false;
        });
});
</script>
<div class="news-content" style="margin-top: 20px;">
    <input type="submit" value="Đồng ý" class="btn btn-success"/>
</div>
</form>